package com.sweets.look.ui.setting;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import com.sweet.satellite.TranslucentSBActivity;
import com.sweets.look.R;
import com.sweets.look.ui.activity.AboutActivity;
import com.sweets.look.ui.activity.BrowserActivity;
import com.sweets.look.util.Utils;
import com.sweets.look.util.ViewUtils;

public class AboutSettings extends TranslucentSBActivity {
    private Context mContext;
    private TextView mVersionText;


    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.setContentView(R.layout.settings_about);
        this.setToolbarTitle(R.string.settings_about);
        this.mContext = this;
        ViewUtils.swipeToFinish(this.findViewById(R.id.settingLayout), this);
        this.mVersionText = (TextView) this.findViewById(R.id.textVersion);
        this.mVersionText.setText(Utils.getAppVersionName(this.mContext));
        if (Utils.isPiracy(this.mContext)) {
            this.mVersionText.setTextColor(getResources().getColor(R.color.orange));//-65536
        }
    }

    public void onSettingsItemClick(View v) {
        switch (v.getId()) {
            case R.id.layoutUpdate: {
                this.startActivity(new Intent("android.intent.action.VIEW", Uri.parse("http://fir.im/2h7g"),
                        this.mContext, BrowserActivity.class));
                this.finish();
                break;
            }
            case R.id.layoutFeedback: {
                this.startActivity(new Intent("android.intent.action.VIEW", Uri.parse("http://form.mikecrm.com/1fTIN9"),
                        this.mContext, BrowserActivity.class));
                this.finish();
                break;
            }
//            case R.id.layoutDonate: {
//                new MarkDialog(this.mContext).builder()
//                        .setTitle(this.mContext.getResources().getString(R.string.donate))
//                        .setMessage(this.getResources().getString(R.string.donate_details))
//                        .setCancelable(true)
//                        .setPositiveButton(this.getResources().getString(R.string.action_ok),
//                                new View.OnClickListener() {
//                                    @Override
//                                    public void onClick(View v) {
//                                        ((ClipboardManager) mContext.getSystemService(CLIPBOARD_SERVICE))
//                                                .setPrimaryClip(ClipData.newPlainText(null, "987001752@qq.com"));
//                                        ViewUtils.showToast(AboutSettings.this.mContext, AboutSettings.this.mContext
//                                                .getResources().getString(R.string.toast_copy_successful));
//                                    }
//                                }).show();
//                break;
//            }
            case R.id.layoutAbout: {
                this.startActivity(new Intent(AboutSettings.this, AboutActivity.class));
                this.finish();
                break;
            }
        }
    }


}

